home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.03 Mar 90 / Mouse Source / TrackInsert.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-07-22  |  802 b   |  35 lines  |  [TEXT/KAHL]

  1. /*                                            TrackInsert.c                                        */
  2. /*
  3.  * Copyright © 1989 Martin Minow. All rights reserved.
  4.  *
  5.  * TrackInsert(text, length, track_handle)
  6.  * Ptr                    text;
  7.  * LONGINT            length;
  8.  * TrackHandle    track_handle;
  9.  *
  10.  * Insert the specified text just before the selection
  11.  * range.  Do not change either the selection range or
  12.  * the Track private scrap.
  13.  */
  14. #include "TrackEdit.h"
  15. #define TR    (*tr)
  16.  
  17. void
  18. TrackInsert(text, length, track_handle)
  19. Ptr                    text;
  20. LONGINT            length;
  21. TrackHandle    track_handle;
  22. {
  23.         register TrackPtr    tr;
  24.         _Track_state            state;
  25.         DOT                                start;
  26.         
  27.         tr = _Track_lock(track_handle, &state);
  28.         start = TR.selStart;
  29.         _Track_do_insert(tr, TR.selStart, text, length);
  30.         TR.selStart += length;
  31.         TR.selEnd += length;
  32.         _Track_rebuild(track_handle, start);
  33.         _Track_unlock(&state);
  34. }
  35.